﻿namespace Spring.PureMVC.Adapters
{
    internal class RegsiterMediatorAdapter
    {
        private object _mediator;
        public object Mediator
        {
            set
            {
                _mediator = value;
                RegisterMediator();
            }
            private get { return _mediator; }
        }

        private object _facade;
        public object Facade
        {
            set
            {
                _facade = value;
                RegisterMediator();
            }
            private get { return _facade; }
        }

        private void RegisterMediator()
        {
            if (Mediator == null || Facade == null) return;
            Facade.GetType().GetMethod("RegisterMediator", new[] { Mediator.GetType() })
.Invoke(Facade, new[] { Mediator });
        }
    }
}
